home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / manage / snmp / kip / gwctl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-01-17  |  3.7 KB  |  120 lines

  1. /*
  2.  * Gateway control packets.
  3.  *
  4.  * (c) 1986, Stanford, BBN, Kinetics.
  5.  * May be used but not sold without permission.
  6.  *
  7.  * $Header: gwctl.h,v 4.1 88/11/01 19:49:34 sw0l Exp $
  8.  */
  9.  
  10.  
  11. #define    rebPort    902        /* rebroadcast port */
  12.  
  13.  
  14. /*
  15.  * Gateway debug protocol (via ddt68 on UNIX).
  16.  */
  17. struct gwdb {
  18.     u_long    magic;        /* magic number */
  19.     u_char    op,seq;        /* op code, sequence number */
  20.     u_short    count;        /* byte count */
  21.     u_long    address;    /* address of read/write */
  22.     u_char    data[512];
  23. };
  24.  
  25. #define    gwdbMagic    ((u_long)0xFF068020)
  26. #define    gwdbPort    900    /* udp port number */
  27. /* op codes */
  28. #define    gwdbRead    1
  29. #define    gwdbWrite    2
  30. #define    gwdbCall    3
  31.  
  32.  
  33. /*
  34.  * Appletalk administration packets from appletalk administrator
  35.  * host (AA) or other gateways; configuration / routing information packet.
  36.  */
  37. struct aaconf {
  38.     u_long    magic;        /* magic number */
  39.     u_char    type;        /* op code */
  40.     u_char    flags;
  41.     u_short    count;        /* byte count of 'stuff' */
  42.     iaddr_t    ipaddr;        /* IP address of sender */
  43.     u_char    stuff[512];    /* config info or routing tuples */
  44. };
  45. #define    aaconfMinSize    12
  46. #define    aaPort    901        /* udp port number (at gateway) */
  47. #define    aaMagic    ((u_long)0xFF068030)
  48. /* type codes */
  49. #define aaCONF        1    /* config request/reply */
  50. #define    aaROUTEI    2    /* initial route table from AA */
  51. #define    aaROUTE        3    /* route table update */
  52. #define aaROUTEQ    4    /* route table update and query */
  53. #define    aaRESTART    5    /* force restart/reconfigure */
  54. #define    aaZONE        6    /* initial zone table from AA */
  55. #define aaZONEQ         7    /* zone query */
  56.  
  57. #define m_stuff(p) ((p)+sizeof(struct ip)+sizeof(struct udp)+aaconfMinSize)
  58.  
  59. /*
  60.  * Routing tuple.
  61.  */
  62. struct arouteTuple {
  63.     long    node;        /* IP net or node address */
  64.     u_short    net;        /* atalk net number */
  65.     u_char    flags;        /* flags, see below */
  66.     u_char    hops;        /* hop count */
  67. };
  68. /* flag values */
  69. #define    arouteBMask    0x03    /* directed broadcast format mask */
  70. #define    arouteCore    0x10    /* node is a 'core' gateway */
  71. #define    arouteAA    0x08    /* this entry received via AA (admin host)*/
  72. #define arouteEtalk    0x01    /* Re-use of field to signify ethertalk */
  73. /* these are mutally exclusive, so treat as values */
  74. #define arouteTYPE 0xe0        /* up to 8 types */
  75. #define    arouteKbox    0x80    /* 'node' is IP address of a Kbox */
  76. #define    arouteNet    0x40    /* node is an IP net#, allowing directed
  77.                    broadcasts in the format given by BMask */
  78. #define    arouteHost    0x20    /* node is an IP host with capability to
  79.                    rebroadcast on its local net */
  80.  
  81.  
  82. /*
  83.  * ATP packet used by client MacIP programs to request
  84.  * name assignment and lookup services.
  85.  */
  86. struct IPGP {
  87.     u_long    op;        /* opcode */
  88.     long    ipaddress;    /* my IP address (or lookup reply)*/
  89.     long    ipname;        /* address of my name server */
  90.     long    ipbroad;    /* my broadcast address */
  91.     long    ipfile;        /* my file server */
  92.     long    ipother[4];    /* other addresses/flags */
  93.     char    string[128];    /* null terminated name/error string */
  94. };
  95. #define    ipgpMinSize    36
  96. /* op codes */
  97. #define    ipgpAssign    1    /* assign new IP address */
  98. #define    ipgpName    2    /* name lookup */
  99. #define    ipgpServer    3    /* just return my server addresses */
  100. #define    ipgpRange    4    /* return start address and range */
  101. #define    ipgpVerify    5    /* verify this IP address is mine */
  102. #define    ipgpError    -1    /* error return op code; string=message */
  103.  
  104.  
  105. /*
  106.  * Stuff dealing with IP/DDP address conversion.
  107.  * WKS = well known socket (DDP term).
  108.  */
  109. #define    defddpWKSUnix    768        /* start of WKS range on UNIX */
  110. #define ddpWKSUnix conf.startddpWKSUnix    /* in conf now */
  111. #define    ddpNWKSUnix    16384        /* start of non-WKS .. */
  112. #define    ddpIPSkt    72        /* used by Dartmouth encapsulation */
  113.  
  114. #define    ddp2ipskt(dskt) (((dskt) & 0x80) ? (dskt) + ddpNWKSUnix \
  115.              : (dskt) + ddpWKSUnix)
  116. /* caution ip2ddpskt can't be used to test if socket is in magic range */
  117. #define ip2ddpskt(iskt) (((iskt) > ddpNWKSUnix) ? (iskt) - ddpNWKSUnix \
  118.              : (iskt) - ddpWKSUnix)
  119.  
  120.